# zope imports
from zope.interface import Interface
from zope.interface import implements

# Five imports
from Products.Five.browser import BrowserView

# CMFCore imports
from Products.CMFCore.utils import getToolByName

class IEditFunctionsView(Interface):    
    """    
    """        
    def showEditFunctions():
        """Returns True if the edit functions are to be displayed.
        """
        
class EditFunctionsView(BrowserView):
    """
    """
    implements(IEditFunctionsView)
        
    def showEditFunctions(self):
        """
        """
        mtool = getToolByName(self.context, "portal_membership")
        
        # "not" works for both: None and False
        if not mtool.checkPermission("Manage portal", self.context):
            return False
            
        return True

